<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>{$pagetitle}</title>
  <meta name="renderer" content="webkit">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
  <link rel="stylesheet" href="/static/admin/layui/css/layui.css" media="all">
  <link rel="stylesheet" href="/static/admin/style/admin.css" media="all">
</head>
<body>
	
<div class="layui-fluid">

    <div id=view></div>

    <div class="version_mark">
        <div class="version_mark_1">当前代码</div>
        <div class="version_mark_2">{:date("Y-m-d H:i:s",$history['addtime'])}修改</div>
    </div>

</div>
    
<div style="display: none;">
	<textarea id="now_content">{$data.now_content}</textarea>
	<textarea id="history_content">{$data.history_content}</textarea>
</div>

<script src="/static/admin/layui/layui.js"></script>
<script src="/static/js/jquery.min.js"></script>    
<script src="/static/js/globals.js"></script>  
<!--代码编辑器插件-->
<link rel="stylesheet" type="text/css" href="/static/admin/codemirror/lib/codemirror.css">
<link rel="stylesheet" href="/static/admin/codemirror/theme/abcdef.css">
<link rel="stylesheet" href="/static/admin/codemirror/doc/docs.css">
<link rel="stylesheet" href="/static/admin/codemirror/addon/merge/merge.css">

<script src="/static/admin/codemirror/lib/codemirror.js"></script>
<script src="/static/admin/codemirror/mode/xml/xml.js"></script>
<script src="/static/admin/codemirror/addon/merge/merge.js"></script>
<script src="/static/admin/codemirror/lib/diff_match_patch.js"></script>

<script type="text/javascript">
	
var value=$("#now_content").val(), orig1=$("#now_content").val(), orig2=$("#history_content").val(), dv, panes = 2, highlight = true, connect = null, collapse = false;
function initUI() {
  if (value == null) return;
  var target = document.getElementById("view");
  target.innerHTML = "";
  dv = CodeMirror.MergeView(target, {
    value: value,
    origLeft: panes == 3 && !collapse && !connect ? orig1 : null,
    orig: orig2,
    lineNumbers: true,
    mode: "text/html",
    highlightDifferences: highlight,
    connect: connect,
    collapseIdentical: collapse
  });
}

function toggleDifferences() {
  dv.setShowDifferences(highlight = !highlight);
}

window.onload = function() {
    initUI();

    
  
};

function mergeViewHeight(mergeView) {
  function editorHeight(editor) {
    if (!editor) return 0;
    return editor.getScrollInfo().height;
  }
  return Math.max(editorHeight(mergeView.leftOriginal()),
                  editorHeight(mergeView.editor()),
                  editorHeight(mergeView.rightOriginal()));
}

function resize(mergeView) {
  var height = mergeViewHeight(mergeView);
  for(;;) {
    if (mergeView.leftOriginal())
      mergeView.leftOriginal().setSize(null, height);
    mergeView.editor().setSize(null, height);
    if (mergeView.rightOriginal())
      mergeView.rightOriginal().setSize(null, height);

    var newHeight = mergeViewHeight(mergeView);
    if (newHeight >= height) break;
    else height = newHeight;
  }
  mergeView.wrap.style.height = 500 + "px";
}
</script>    

</body>
</html>
